package marvin.webapp.shopping.model;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

public class ShoppingList {
	
	private final static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
	
	private String creationDate;
	private List<Item> items;

	public ShoppingList() {
		items = new LinkedList<Item>();
		creationDate = dateFormat.format(new Date());
	}

	public boolean addItem(Item item) {
		return items.add(item);
	}

	public boolean removeItem(Item item) {
		return items.remove(item);
	}

	public String getCreationDate() {
		return creationDate;
	}
	
	public void setCreationDate(String creationDate) {
		this.creationDate = creationDate;
	}

	public List<Item> getItems() {
		return new LinkedList<Item>(items);
	}
}
